package edu.washington.cs.workflow.recommender;

import java.util.List;

import org.uispec4j.UIComponent;

import edu.washington.cs.workflow.analysis.guistructure.Spec4JUtils;
import junit.framework.TestCase;

public class TestRESTBasedRecommender extends TestCase {
	
//	public void testCrossword() {
//		String mainClass = "crosswordsage.MainScreen";
//		String[] args = new String[]{};
//		RESTBasedRecommender recommender = new RESTBasedRecommender(mainClass, args, "Crossword Builder", null);
//		List<UIComponent> comps = recommender.findGUIElements();
//		
//		System.out.println("Results: ");
//		for(UIComponent c : comps) {
//			System.out.println("   " + Spec4JUtils.getLabel(c));
//		}
//		assertEquals(0, comps.size());
//	}

	public void testJEdit() {
		String mainClass = "org.gjt.sp.jedit.jEdit";
		String[] args = new String[]{};
		RESTBasedRecommender recommender = new RESTBasedRecommender(mainClass, args, "Go to Previous Buffer", null);
		List<UIComponent> comps = recommender.findGUIElements();
		
		System.out.println("Results: ");
		for(UIComponent c : comps) {
			System.out.println("   " + Spec4JUtils.getLabel(c));
		}
		assertEquals(1, comps.size());
	}
	
	public void testJabRef() {
		String mainClass = "net.sf.jabref.JabRef";
		String[] args = new String[]{};
		RESTBasedRecommender recommender = new RESTBasedRecommender(mainClass, args, "Search", null);
		List<UIComponent> comps = recommender.findGUIElements();
		
		System.out.println("Results: ");
		for(UIComponent c : comps) {
			System.out.println("   " + Spec4JUtils.getLabel(c));
		}
		assertEquals(3, comps.size());
	}
	
	public void testFreemind_1() {
		String mainClass = "freemind.main.FreeMind";
		String[] args = new String[]{};
		RESTBasedRecommender recommender = new RESTBasedRecommender(mainClass, args, "Zoom In", null);
		List<UIComponent> comps = recommender.findGUIElements();
		
		System.out.println("Results: ");
		for(UIComponent c : comps) {
			System.out.println("   " + Spec4JUtils.getLabel(c));
		}
		assertEquals(1, comps.size());
	}
	
	public void testFreemind_2() {
		String mainClass = "freemind.main.FreeMind";
		String[] args = new String[]{};
		RESTBasedRecommender recommender = new RESTBasedRecommender(mainClass, args, "Previous Map", null);
		List<UIComponent> comps = recommender.findGUIElements();
		
		System.out.println("Results: ");
		for(UIComponent c : comps) {
			System.out.println("   " + Spec4JUtils.getLabel(c));
		}
		assertEquals(1, comps.size());
	}
	
	public void testFreemind_3() {
		String mainClass = "freemind.main.FreeMind";
		String[] args = new String[]{};
		RESTBasedRecommender recommender = new RESTBasedRecommender(mainClass, args, "Bezier", null);
		List<UIComponent> comps = recommender.findGUIElements();
		
		System.out.println("Results: ");
		for(UIComponent c : comps) {
			System.out.println("   " + Spec4JUtils.getLabel(c));
		}
		assertEquals(1, comps.size());
	}
	
	public void testFreemind_4() {
		String mainClass = "freemind.main.FreeMind";
		String[] args = new String[]{};
		RESTBasedRecommender recommender = new RESTBasedRecommender(mainClass, args, "Toggle Toolbar", null);
		List<UIComponent> comps = recommender.findGUIElements();
		
		System.out.println("Results: ");
		for(UIComponent c : comps) {
			System.out.println("   " + Spec4JUtils.getLabel(c));
		}
		assertEquals(1, comps.size());
	}
}
